Skip to content

[GEN][ZH] Prevent unlikely buffer overrun while writing to 'newPts' in PolygonTrigger::reallocate()#1091

Merged
xezon merged 1 commit intoTheSuperHackers:mainfrom
xezon:xezon/staticanalysis2/006
Jun 21, 2025
Merged

[GEN][ZH] Prevent unlikely buffer overrun while writing to 'newPts' in PolygonTrigger::reallocate()#1091
xezon merged 1 commit intoTheSuperHackers:mainfrom
xezon:xezon/staticanalysis2/006

Conversation

@xezon
Copy link
Copy Markdown

@xezon xezon commented Jun 19, 2025

This change prevents an unlikely buffer overrun while writing to 'newPts' in PolygonTrigger::reallocate() and makes the compiler happy.

GeneralsMD\Code\GameEngine\Source\GameLogic\Map\PolygonTrigger.cpp(105): warning C6386: Buffer overrun while writing to 'newPts':  the writable size is 'm_sizePoints*12' bytes, but '24' bytes might be written.

@xezon xezon added Minor Severity: Minor < Major < Critical < Blocker Fix Is fixing something, but is not user facing labels Jun 19, 2025
@xezon xezon force-pushed the xezon/staticanalysis2/006 branch from a4b8323 to a9fd1d2 Compare June 20, 2025 07:31
@Caball009
Copy link
Copy Markdown

What warning settings are required to get a warning here? I can't replicate it, nor do I really understand what the warning is about.

@xezon
Copy link
Copy Markdown
Author

xezon commented Jun 21, 2025

This warning is created by running the Code Analysis in Visual Studio:

https://learn.microsoft.com/en-us/cpp/code-quality/code-analysis-for-c-cpp-overview?view=msvc-170

Copy link
Copy Markdown

@Skyaero42 Skyaero42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@xezon xezon merged commit 795c025 into TheSuperHackers:main Jun 21, 2025
14 checks passed
@xezon xezon deleted the xezon/staticanalysis2/006 branch June 21, 2025 21:12
fbraz3 pushed a commit to fbraz3/GeneralsX that referenced this pull request Nov 10, 2025
fbraz3 pushed a commit to fbraz3/GeneralsX that referenced this pull request Feb 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Fix Is fixing something, but is not user facing Minor Severity: Minor < Major < Critical < Blocker

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants